import React, { Component } from 'react'

export default class Test extends Component {
  constructor() {
    super()
    console.log('挂载阶段-constructor', this)
  }
  render() {
    console.log('挂载/更新阶段-render', this)
    return (
      <div>
        Test,
        <button
          onClick={() => {
            this.forceUpdate()
          }}
        >
          强制更新
        </button>
      </div>
    )
  }
  componentDidMount() {
    console.log('挂载阶段-componentDidMount', this)
  }
  componentDidUpdate() {
    console.log('更新阶段-componentDidUpdate', this)
  }
  componentWillUnmount() {
    console.log('卸载阶段-componentWillUnmount', this)
  }
}
